cap program drop robustplot
program robustplot
	syntax , [replace robust spec(string) Save(string)]

	//save current data
	tempfile temp
	save "`temp'",replace

	//dataset to store estimates
	if "`replace'"!=""{
		clear
		gen beta=.
		gen se=.
		gen bw=.
		gen spec_id=.
		gen u95=.
		gen u90=.
		gen l95=.
		gen l90=.
		save "`save'.dta",replace
	}
	else{
		//load dataset
		use "`save'.dta",clear
	}

	//add observation
	local obs=_N+1
	set obs `obs'
	replace spec_id=`obs' if _n==`obs'

	//store estimates
	if "`robust'"!=""{
	replace beta = e(tau_bc) if spec_id==`obs'
	replace se = e(se_tau_rb) if spec_id==`obs'
	}
	if "`robust'"==""{
	replace beta = e(tau_cl) if spec_id==`obs'
	replace se = e(se_tau_cl) if spec_id==`obs'	    
	}
	
	replace bw=e(h_l) if spec_id==`obs'
	replace u95=beta+abs(invnormal(0.025))*se if spec_id==`obs'
	replace u90=beta+abs(invnormal(0.05))*se if spec_id==`obs'
	replace l95=beta-abs(invnormal(0.025))*se if spec_id==`obs'
	replace l90=beta-abs(invnormal(0.05))*se if spec_id==`obs'

	//store specification
	foreach s in `spec'{
	cap gen `s'=1 if spec_id==`obs'
	cap replace `s'=1 if spec_id==`obs'
	}
	sleep 500
	save "`save'.dta",replace

	//restore dataset
	use `temp', clear
end